package com.chentongwei.spring.annotation.configuration;

import com.chentongwei.spring.annotation.configuration.config.MainConfig;
import com.chentongwei.spring.annotation.configuration.entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author TongWei.Chen 2018-06-29 14:36:50
 * @Description:
 * @Project spring-annotation
 */
public class MainAnonationTest {

    public static void main(String[] args) {
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfig.class);

        User user = applicationContext.getBean("user01", User.class);
        System.out.println(user);

        String[] beanNamesForType = applicationContext.getBeanNamesForType(User.class);
        for (String name : beanNamesForType) {
            System.out.println(name);
        }
    }

}
